format date field in pandas

57

format date field in pandas -

df['date'] = pd.to_datetime(df["date"].dt.strftime('%Y-%m'))

apply format to pandas datetime column -

formatted_df = df["Date"].dt.strftime("%m/%d/%y")

Comments

Submit
0 Comments